/**
 *
 */
package com.angel.email.dtos;

import javax.mail.Folder;
import javax.mail.MessagingException;

import com.angel.architecture.exceptions.NonBusinessException;


/**
 * @author William
 *
 */
public class FolderDTO {

	private String fullName;
	private String name;
	private FolderDTO parentFolderDTO;
	private Integer messageCount;
	private Integer unreadMessageCount;
	private Integer mode;
	private char separator;
	private Integer type;

	public FolderDTO(){
		super();
	}

	public FolderDTO(Folder folder){
		this();
		try {
			this.setFullName(folder.getFullName());
			this.setName(folder.getName());
			if(folder.getParent() != null && folder.getParent().isOpen()){
				this.setParentFolderDTO(new FolderDTO(folder.getParent()));
			}
			this.setMessageCount(folder.getMessageCount());
			this.setUnreadMessageCount(folder.getUnreadMessageCount());
			this.setMode(folder.getMode());
			this.setSeparator(folder.getSeparator());
			this.setType(folder.getType());
		} catch (MessagingException e) {
			// TODO Auto-generated catch block
			new NonBusinessException("Error getting unread message count for folder [" + folder.getName() + "].", e);
		}
	}

	public String getFullName() {
		return fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public FolderDTO getParentFolderDTO() {
		return parentFolderDTO;
	}

	public void setParentFolderDTO(FolderDTO parentFolderDTO) {
		this.parentFolderDTO = parentFolderDTO;
	}

	public Integer getMessageCount() {
		return messageCount;
	}

	public void setMessageCount(Integer messageCount) {
		this.messageCount = messageCount;
	}

	public Integer getUnreadMessageCount() {
		return unreadMessageCount;
	}

	public void setUnreadMessageCount(Integer unreadMessageCount) {
		this.unreadMessageCount = unreadMessageCount;
	}

	public Integer getMode() {
		return mode;
	}

	public void setMode(Integer mode) {
		this.mode = mode;
	}

	public char getSeparator() {
		return separator;
	}

	public void setSeparator(char separator) {
		this.separator = separator;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}
}
